<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>收货地址</title>
	<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/zepto.js" charset="utf-8"></script>
    <style type="text/css">
        * {
            outline: none;
            -webkit-tap-highlight-color: rgba(255, 0, 0, 0);
            vertical-align: baseline;
            font-style: normal;
        }

        body {
            margin: 0;
            padding: 0;
            font-size: 12px;
            font-family: Microsoft Yahei, Arial, Simsun, Helvetica, Segoe UI, sans-serif;
            color: #404040;
            background-color: #efeff4;
        }

        img {
            border: 0
        }

        ul, ol, li, dt, dl, dd {
            text-decoration: none;
            list-style: none;
            vertical-align: middle;
            margin: 0;
            padding: 0;
        }

        a,
        a:visited {
            color: #373737;
            text-decoration: none;
        }

        .blank {
            width: 100%;
            height: 20px;
        }
		#getCode {color:#777;margin-right:20px;text-align:right;margin-top:8px;background:#fff;float:right;cursor:pointer;}
		 .blank {
            width: 100%;
            height: 20px;
        }

        .clear, .space {overflow: hidden; height: 0px; line-height: 0px; background: none; border: none; padding: 0; margin: 0;}
        .clear {clear: both;}
        .userinfoMain {
            width: 100%;
            background-color: #FFF;
            display: table;
        }

        .userinfoMain .userinfoItem {
            height: 50px;
            line-height: 50px;
        }

      
        .userinfoMain .userinfoItem {
		    height:70px;
			padding-top:10px;
            border-bottom: 1px solid #dbdbdb;
        }

        .userinfoMain .userinfoItem:last-child {
            border-bottom: none;
        }
		.adLeft {width:85%;float:left;}
		.adRight {width:15%;float:left;}
		.unSelect {color:#888;}
		.unSelect .checkBox {width:26px;height:26px; margin:16px 5px 16px 0px;background-image: url(<?php echo TEMPLATE_SITE_URL;?>/images/checkIcons.png);background-size: 100% auto;}
		.selected .adRight .checkBox {width:26px;height:26px; margin:16px 5px 16px 0px;background-image: url(<?php echo TEMPLATE_SITE_URL;?>/images/checkIcons.png);background-size: 100% auto;background-position: 0px -26px;}
		.adLeft p {margin:0px;margin-left:15px;line-height:22px;margin-top:5px;}
		.adLeft p span {font-size:14px;}
		.adLeft p b {font-size:14px;font-weight:100;margin-right:20px;float:right;}
		.add {height:40px;padding-top:5px;padding-bottom:5px;border-top: 1px solid #dbdbdb;background:#fff url(<?php echo TEMPLATE_SITE_URL;?>/images/right_arrow.png) right 20px center no-repeat;}
		.add span {display:block;padding-left:30px;line-height:25px;margin-top:10px;margin-left:15px;background:url(<?php echo TEMPLATE_SITE_URL;?>/images/add.jpg) left center no-repeat;}
 		.shield{ width:100%;height:100%;  background:url(<?php echo TEMPLATE_SITE_URL;?>/images/shield1.png);position:fixed;z-index:9999;}
	  	.shieldDiv{width:100%;background:#fff;/*实现IE背景透明*/position:fixed; bottom:0;}
	  	.shildBn {color:#555;width:100%;height:35px;line-height:35px;display:block;border-top:#ddd 1px solid;text-align:center;}
	  	.shildBn:hover {text-decoration:none;}		
		</style>
</head>
<body>
         <div class="shield" style="display: none;">
           <div class="shieldDiv">
              <a class="shildBn defaultaddr" style="color:#eb5153;">设置默认地址</a>              
              <a class="shildBn deladdr">删除收货地址</a>
              <a class="shildBn canceladdr">取消</a>
              <input type="hidden" name="addressid">
              <input type="hidden" name="order_id" value="<?php echo $_GET['order_id'];?>">
              <input type="hidden" name="auction_id" value="<?php echo $_GET['auction_id'];?>">
           </div>
           
           <script type="text/javascript">
				$(function(){

					$('.defaultaddr').click(function(){
						var addressid = $('input[name=addressid]').val();
						var order_id = $('input[name=order_id]').val();
						var auction_id = $('input[name=auction_id]').val();
						
						$.ajax({
							type:'post',
							url:'index.php?act=payment&op=defaultaddress',
							data:{addressid:addressid,order_id:order_id},
							dataType:'json',
							success:function(data){
								if(order_id!=''){
									location.href = 'index.php?act=payment&op=orderpayment&order_id='+order_id;
								}else if(auction_id!=''){
									location.href = 'index.php?act=payment&op=accepttuikuan&auction_id='+auction_id;
								}else{
									location.reload();
								}
							}
						});				
					});

					$('.deladdr').click(function(){
						var addressid = $('input[name=addressid]').val();
						$.ajax({
							type:'post',
							url:'index.php?act=payment&op=deladdress',
							data:{addressid:addressid},
							dataType:'json',
							success:function(data){
								location.reload();
							}
						});
					});

					
					$('.canceladdr').click(function(){
						$('.shield').hide();
					});
				});
           </script>
        </div>
    <div id="contentbox" >
        <div class="blank"></div>

        <div class="userinfoMain">
        	<?php if(!empty($output['address'])){?>
			<?php foreach($output['address'] as $address){?>
            <div class="userinfoItem <?php if($address['is_default']==1){ echo 'selected';}else{ echo 'unSelect';}?>" addressid="<?php echo $address['id'];?>">
                <div class="adLeft">
                	<p><span><?php echo $address['name'];?></span><b><?php echo $address['tele'];?></b></p>
                	<p>
                		<?php echo $address['prov_name'];?>
                		<?php echo $address['city_name'];?>
                		<?php echo $address['dis_name'];?>
                		<?php echo $address['address'];?>
                	</p>
                </div>
                <div class="adRight"><div class="checkBox"></div></div>
                <div class="clear"></div>
            </div>
        	<?php }?>
			<?php }?>    
        </div>
        <?php ?>
        
        <?php if(!empty($_GET['order_id'])){?>
        <a href="index.php?act=payment&op=addressadd&order_id=<?php echo $_GET['order_id'];?>">
        <?php }else{?>
        <a href="index.php?act=payment&op=addressadd&auction_id=<?php echo $_GET['auction_id'];?>">
        <?php }?>
        	<div class="add"><span>新增地址</span></div>
        </a>
    </div>

<script type="text/javascript">
$(function(){
	$('.userinfoItem').click(function(){
		var addressid = $(this).attr('addressid');
		$("input[name=addressid]").val(addressid);
		$('.shield').show();

	});	
});
</script>
</body>
</html>